package com.mutual.base.utils;

import java.util.UUID;

import org.apache.commons.lang3.RandomStringUtils;

/**
 * 随机数util类
 * @create-time 2016年3月4日 上午10:59:32
 * @version     1.0
 */
public class RandomUtil {
	
	/** 字符 */
	public static final String CHAR_ONLY = "abcdefghijklmnopqrstuvwxyz";
	/** 字符和数字 */
	public static final String CHAR_AND_DIGIT = "abcdefghijklmnopqrstuvwxyz1234567890";
	/** 数字 */
	public static final String DIGIT = "1234567890";

	/**
	 * 生成随机字符
	 * @param length
	 * @param chars
	 * @return
	 */
	public static String randomChar(int length,String chars){
		String str = RandomStringUtils.random(length,chars);
		return str;
	}
	
	/**
	 * 生成UUID字符
	 * @return
	 */
	public static String uuid() {
		String uuid = UUID.randomUUID().toString().replaceAll("-", "");
		return uuid;
	}
}
